﻿namespace question9
{
    public interface A
    {
        double Area();
    }

    public interface B
    {
        void SetColor(string c);
    }

    public interface C : A, B
    {
        void Volume();
    }

    public class Cylinder : C
    {
        private double radius;  
        private double height;  
        private string color;   

        public Cylinder(double radius, double height, string color)
        {
            this.radius = radius;
            this.height = height;
            this.color = color;
        }

        public double Area()
        {
            return Math.PI * radius * radius;
        }

        public void SetColor(string c)
        {
            color = c;
        }

        public void Volume()
        {
            double volume = Area() * height;
            Console.WriteLine($"圆柱体的体积为: {volume:F2}");
        }

        public string GetColor()
        {
            return color;
        }

        public void DisplayInfo()
        {
            Console.WriteLine("圆柱体信息:");
            Console.WriteLine("==============================");
            Console.WriteLine($"底圆半径: {radius:F2}");
            Console.WriteLine($"高度: {height:F2}");
            Console.WriteLine($"颜色: {color}");
            Console.WriteLine($"底面积: {Area():F2}");
        }
    }
    public class Program
    {
        public static void Main()
        {
            Cylinder cylinder = new Cylinder(3.5, 10.0, "蓝色");
            cylinder.DisplayInfo();
            cylinder.Volume();
        }
    }
}
